<template>
  <div>
    <gs-header :title="pageTitle"/>
    <div class="page-index-list">
      <indexList ref="indexList" :list="list" />
    </div>
  </div>
</template>

<script type="text/ecmascript-6">
import IndexList from 'example/components/index-list/index-list'
import GsHeader from 'example/components/gs-header/gs-header'
import cityData from 'example/data/index-list.json'

export default {
  name: 'PageIndexList',
  created () {
    let ret = []
    cityData.forEach(cityGroup => {
      let group = {}
      group.name = cityGroup.name
      group.items = []
      cityGroup.cities.forEach(city => {
        let item = {}
        item.name = city.name
        item.value = city.cityid
        group.items.push(item)
      })
      ret.push(group)
    })
    this.list = ret
  },
  data () {
    return {
      pageTitle: '通讯录',
      list: [],
      pageNo: 1
    }
  },
  components: {
    IndexList,
    GsHeader
  },
  methods: {}
}
</script>
